﻿<!DOCTYPE html>

<html>

<head>
    <title>营销员</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

    <meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">

    <link rel="stylesheet" href="/static/css/weui.min.css">
    <link rel="stylesheet" href="/static/css/jquery-weui.css">
    <link rel="stylesheet" href="/static/css/demos.css">
    <link rel="stylesheet" href="/static/css/example.css" />
    <link rel="stylesheet" href="/static/css/iconfont.css">

    <style type="text/css">
        .wy-header {
            height: 38px;
            border-bottom: 1px solid #e1e1e1;
            position: relative;
        }

        .wy-header-icon-menu {
            position: absolute;
            left: 0;
            top: 0;
            width: 40px;
            height: 38px;
        }

        .wy-header-icon-menu span {
            width: 20px;
            height: 20px;
            margin: 8px 0 0 10px;
            background: url(/static/img/list/icon_nav_actionSheet.png) no-repeat;
            background-size: 20px;
            display: block;
        }

        .wy-header-title {
            margin: 0 50px;
            text-align: center;
            height: 38px;
            line-height: 38px;
            font-size: 20px;
            color: #252525;
        }

        .wy-header-icon-back {
            position: absolute;
            right: 0;
            top: 0;
            width: 40px;
            height: 38px;
        }

        .wy-header-icon-back span {
            width: 20px;
            height: 20px;
            margin: 8px 0 0 10px;
            background: url(/static/img/list/icon-back.png) no-repeat;
            background-size: 20px;
            display: block;
        }

        .wxCellGlay {
            background-color: #ccc8c8;
        }

        /*首页图标链接*/

        .wy-iconlist-box {
            background: #fff;
            padding: 0 10px;
        }

        .wy-links-iconlist {
            display: block;
            text-align: center;
            margin: 10px 0;
        }

        .wy-links-iconlist .img {
            margin: 0 23px;
        }

        .wy-links-iconlist img {
            width: 100%;
        }

        .wy-links-iconlist p {
            font-size: 11px;
            color: #454545;
            margin-top: 5px;
        }
    </style>



</head>


<body ontouchstart>

    <div class="weui-toptips weui-toptips_warn js_tooltips">错误提示</div>


    <div class="container" id="container"></div>
    <!-- 容器  -->

    <!-- demo  -->
    <script type="text/html" id="tpl_demo">
<div class="page">

    <div class="page__hd">
        <a href="javascript:home()"><img src="/static/images/icon_footer.png" /></a>
    </div>

    <div class="page__bd page__bd_spacing">
    <a href="javascript:home()"><img src="/static/images/icon_footer.png" /></a>
    </div>

    <div class="page__ft">
        <a href="javascript:home()"><img src="/static/images/icon_footer.png" /></a>
    </div>


</div>
     <script type="text/javascript">
         
      </script>

    </script>




    <script type="text/html" id="tpl_home">
        <div class="page">

            <!--浮动 头部-->
            <div class="page__hd" style="position: fixed; z-index: 99; width: 100%">
                <header class='weui-header fixed-top'>

                    <div class="weui-search-bar" id="searchBar">
                        <!--三个点--> <div class="wy-header-icon-menu" id="gomenu" style="position: absolute; left: 0; top: 4px; width: 35px; height: 38px;"><span></span></div>
                        <form class="weui-search-bar__form" action="#" style="margin-left: 40px">
                            <div class="weui-search-bar__box">
                                <i class="weui-icon-search"></i>
                                <input type="search" class="weui-search-bar__input" id="searchInput" placeholder="搜索" onblur="LostFoucs()">
                                <a href="javascript:" class="weui-icon-clear" id="searchClear"></a>
                            </div>
                            <label class="weui-search-bar__label" id="searchText" style="transform-origin: 0px 0px 0px; opacity: 1; transform: scale(1, 1);">
                                <i class="weui-icon-search"></i>
                                <span>搜索</span>
                            </label>
                        </form>
                        <a href="javascript:var event={};event.keyCode='13'; searchNow(event);" class="weui-search-bar__search-btn" >搜索</a>
                        <a href="javascript:clearSearch();" class="weui-search-bar__cancel-btn" id="searchCancel">取消</a>
                    </div>

                </header>

                <!--  上面的浮动快捷菜单 导航子功能 -->
               <div class="weui-panel weui-panel_access" style="margin-top: 0px">
                    <div class="weui-flex wy-iconlist-box" style="padding: 0 10px;">
                        <div class="weui-flex__item">
                            <a href="javascript:g_YXId=null;window.pageManager.go('YingxiaoEdit');" class="wy-links-iconlist">
                                <div class="img">
                                      <img src="/static/images/add.png"> 
                                </div>
                                <p>录入</p>
                            </a>
                        </div>
                        <div class="weui-flex__item">
                            <a href="javascript:EditCell();" class="wy-links-iconlist">
                                <div class="img">
                                     <img src="/static/images/edit.png"> 
                                </div>
                                <p>修改</p>
                            </a>
                        </div>
                       <!--  <div class="weui-flex__item">
                            <a href="javascript:;" class="wy-links-iconlist" id="scanQRCode">
                                <div class="img">
                                      <img src="/static/images/cust.png"> 
                                </div>
                                <p>扫描</p>
                            </a>
                        </div> -->
                        <div class="weui-flex__item">
                            <a href="javascript:DetailCell();" class="wy-links-iconlist">
                                <div class="img">
                                      <img src="/static/images/detail.png"> 
                                </div>
                                <p>详情</p>
                                <div id='jigouhao' style ="display:none">JRDWMC20180034</div>
                            </a>
                        </div>
                        <div class="weui-flex__item">
                            <a href="javascript:deleteCell();" class="wy-links-iconlist">
                                <div class="img">
                                    <img src="/static/images/del.png">  
                                </div>
                                <p>交接</p>
                            </a>
                        </div>
                        <div class="weui-flex__item">
                            <a href="javascript:history.back();" class="wy-links-iconlist">
                                <div class="img">
                                      <img src="/static/images/back.png"> 
                                </div>
                                <p>返回</p>
                            </a>
                        </div>
                    </div>
                </div>


            </div>
     
            

            <!--中间部分-->
            <div class="page__bd page__bd_spacing" style="margin-top: 119px">   

                <div class="weui-panel weui-panel_access" style="margin-top: 10px;">
                    <div class="weui-panel__bd">
                        <div class="weui-media-box weui-media-box_small-appmsg">
                            <!-- <div class="weui-flex">
                                <div class="weui-flex__item" ><div class="placeholder" style="text-align:center">姓名</div></div>
                                <div class="weui-flex__item"><div class="placeholder" style="text-align:center">资产</div></div>
                                <div class="weui-flex__item"><div class="placeholder" style="text-align:center">有效性</div></div>
                            </div> -->
                            <div class="weui-cells" id="YxList">  <!--营销员列表容器  从ajax把数据扔到这里-->
                                
                                <!--
                                <div class="weui-cell weui-cell_access" href="javascript:;" style="background-color: #ccc8c8;">
                                    <div class="weui-cell__bd">
                                        <p>营销员1</p>
                                    </div>
                                </div>
                                
                                -->

                            </div>
                        </div>
                    </div>
                </div>
               <div class="weui-btn-area" id="ftLoad"> 
                    <!-- <a href="javascript:;" class="weui-btn weui-btn_default weui-btn_loading" style="color:#353535"><i class="weui-loading"></i>正在加载...</a> -->
                    <a href="javascript:;" class="weui-btn weui-btn_default" id="ClickLoadMore" style="color:#353535">点击加载更多</a>
                </div>
                <!--底部-->
                <div class="page__ft" > 
                  
                </div>

            </div>

  <script type="text/javascript">

                function LostFoucs() {              
                   // $('#searchCancel').trigger('click');
                  //  clearSearch();
                }
              window.YXCallBack =  function (ygid,vName,cardid,phone) {
                    setTimeout(function () {
                        if( vName &&  phone)
                        {
 
                            if($('#' + ygid).length>0){
                                console.log('进入修改')
                                console.log(ygid)
                                console.log(vName)
                                console.log(cardid)
                                console.log(phone)
                                $('#' + ygid).attr("name",vName);
                                $('#' + ygid).attr("cardid",cardid);
                                $('#' + ygid).attr("phone",phone);

                                //$('#' + ygid).attr("id",phone);
                                //$('#' + ygid).children().find('p').html(vName);
                                //console.log( $('#' + ygid).find('.weui-cell__bd'));
                                //$('#' + ygid).find('.weui-cell__bd').find('p').html(vName);
                                $('p[name="xingming"]','#' + ygid).html(vName);
                               // $(this).css('background-color', '#ccc8c8');
                                $('#' + ygid).css("background-color","");

                             //$('#' + phone).find('p').html(vName);                       
                                $.toast('修改成功',800);  //调整延时时间
                            }
                            else{
                                //  alert(vid);
                                $("#YxList").prepend(append_customer_html_2(vName,phone,cardid,ygid));
                                 RegClick() ;
                                $.toast('添加成功',800);
                            }
                        }
                    }, 500);
                }

                var Cellid = null;

function deleteCell() {
    if(Cellid){
    if($('#' + Cellid).length<=0){
        $.toptip('请选择要删除的项目', 'error');
        return;
    }
    $.confirm("您确定要删除吗?", "确认删除?", function() {

//删除
$.ajax({
            url: basePath1+"testServlet",

            type: "GET",
            data: {action: 'delete',
                   YGid:Cellid
            },
            crossDomain: true,
            dataType: "json",
            success: function (callBackData, textStatus, jqXHR) {
                if(callBackData[0].SUCCESS=="OK"){
                       $("#" + Cellid).remove();
                         $.toptip('删除成功', 'success');
                  }
                  else{ $.toptip('删除失败', 'error');}

             //    $("#YxList").children().remove();
            },error: function (XMLHttpRequest, strError, strObject) { 
               $.alert('网络有问题,请刷新!strError=' + strError + ' strObject=' + strObject);  
          }
        });                          
                   }, function() {
                      //取消操作
                       
                   });


                   }   
                   else{ $.toast('请选择营销员', "forbidden");}
                }

                function appendhtml(Num,id) {
                    var htmcode = '<a class="weui-cell weui-cell_access js_item" id="' + id + '" name="'+Num+'"  href="javascript:;">' +
                                    ' <div class="weui-cell__bd">' +
                                         '<p>' + Num + '</p>' +
                                     '</div>' +
                                  '</a>';

                    return htmcode;
                }


                function append_customer_html_2(name,phone,cardid,id) {
                    var htmcode = '<a class="weui-cell weui-cell_access js_item" id="' + id + '" name="'+name+'"cardid="'+ cardid +'"phone="'+phone+'"href="javascript:;">' +
                                    ' <div class="weui-cell__bd">' +
                                         '<p  name="xingming">' + name + '</p>' +
                                     '</div>' +
                                  '</a>';

                    return htmcode;
                }


                function append_customer_html(name,cardid,total_num,phone,first_num,yxkh,first_time) {
                    var htmcode = '<div class="weui-flex weui-cell_access js_item" id="' + cardid + '" name="' + name + '" phone="'+ phone + '" first_time="' +first_time+'" first_num="'+first_num+ '"  href="javascript:;">'+
                        '<div class="weui-flex__item" >'+'<div class="placeholder" style="text-align:center">'+name+'</div>'+'</div>'+
                        '<div class="weui-flex__item" >'+'<div class="placeholder" style="text-align:center">'+total_num+'</div>'+'</div>'+
                        '<div class="weui-flex__item" >'+'<div class="placeholder" style="text-align:center">'+yxkh+'</div>'+'</div>'+
                    '</div>';

                    return htmcode;
                }
function regmoreclick() {
    
    $("#ClickLoadMore").click(function () {
        $('#ClickLoadMore').hide();
        $("#ftLoad").append('<a href="javascript:;" id="idLoading" class="weui-btn weui-btn_default weui-btn_loading" style="color:#353535"><i class="weui-loading"></i>正在加载...</a>');
        var loadmoreCur=$('#YxList').find('.weui-cell_access').length;
        var kwd = $('#searchInput').val();
        var jigouhao = $('#jigouhao').html()
        kwd = kwd.trim();
        //加载更多 
        $.ajax({
                    url: basePath1+"customer_more",

                    type: "GET",
                    data: {action: 'find',
                        name_find:kwd,
                        offset:loadmoreCur,
                        dwid : jigouhao,
                        pagesize:pagesize
                    },
                    crossDomain: true,
                    dataType: "json",
                    success: function (callBackData, textStatus, jqXHR) {
                        if(callBackData.length==0 ){
                            $("#ftLoad").children().remove();
                            $("#ftLoad").append('<a href="javascript:;" class="weui-btn weui-btn_default"  style="color:#353535">没有更多数据了</a>');
                            return;
                        }
                        else if(callBackData.length<pagesize){
                            $("#ftLoad").children().remove();
                            $("#ftLoad").append('<a href="javascript:;" class="weui-btn weui-btn_default"  style="color:#353535">没有更多数据了</a>');
                                
                                var YxItemLists = $('#YxList').find('.weui-cell_access');
                                var nIndexCur = YxItemLists.length;
                                for (var j = 0; j < callBackData.length; j++, nIndexCur++) {                             
                                    $("#YxList").append(append_customer_html_2(callBackData[j].name,callBackData[j].phone,callBackData[j].cardid,callBackData[j].id));//点击 加载更多营销员
                                }
                            RegClick() ;
                            return;
                        }
                        else{
                            $("#idLoading").remove();
                            $('#ClickLoadMore').show();
                            var YxItemLists = $('#YxList').find('.weui-cell_access');
                                var nIndexCur = YxItemLists.length;
                                for (var j = 0; j < callBackData.length; j++, nIndexCur++) {                             
                                    $("#YxList").append(append_customer_html_2(callBackData[j].name,callBackData[j].phone,callBackData[j].cardid,callBackData[j].id));//点击 加载更多营销员
                                }
                            RegClick() ;
                        }
                    },error: function (XMLHttpRequest, strError, strObject) { 
                    $.alert('网络有问题,请刷新!strError=' + strError + ' strObject=' + strObject);  
                }
                });                       
                            
    });

            
}
            

                function EditCell() {
                  if(Cellid){
                     if($('#' + Cellid).length<=0){
                        //$.toptip('请选择要修改的项目', 'error');
                        $.toast('请选择要修改的项目', "forbidden");
                        return;
                      }
                      g_YXId=Cellid;
                      g_YXname=  $('#' +g_YXId).attr("name");
                      g_YXphone=  $('#' +g_YXId).attr("phone");
                      g_YXfirst_time=  $('#' +g_YXId).attr("first_time");
                      g_YXfirst_num=  $('#' +g_YXId).attr("first_num");
                      g_YXcardid=  $('#' +g_YXId).attr("cardid");

                     

                       window.pageManager.go('YingxiaoEdit');
                    }
                    else{ $.toast('请选择要修改的项目', "forbidden");}
                 }

                    function StandardPost(url, args) {
                    var form = $("<form method='post'></form>");
                    form.attr({ "action": url });
                    for (arg in args) {
                    var input = $("<input type='hidden'>");
                    input.attr({ "name": arg });
                    input.val(args[arg]);
                    form.append(input);
                    }
                    //$(document).append(form);
                    window.document.body.appendChild(form.get(0));
                    form.submit();
                    }
                 function DetailCell() {
                  if(Cellid){
                     if($('#' + Cellid).length<=0){
                        //$.toptip('请选择要修改的项目', 'error');
                        $.toast('请选择要的项目', "forbidden");
                        return;
                      }
                      g_YXId=Cellid;
                      g_YXname=  $('#' +g_YXId).attr("name");
                      var vcardId=  $('#' +g_YXId).attr("cardid");
                      
                      StandardPost('http://jdzpost.jxpost.com/jdzpostQianTai/WebSite2/Salesman/KehuZongzichan.jsp?#',{arg_kehuZongzichan:'yes',cardid:vcardId});
                       //window.pageManager.go('YingxiaoEdit');
                    }
                    else{ $.toast('请选择要修改的项目', "forbidden");}
                 }
                
                //监听搜索事件
                //document.getElementById('searchInput').addEventListener('keyup', function (e) { if (e.keyCode == 13) { searchNow(); } });
                $('#searchInput').bind('keypress', searchNow);
                //核心搜索函数

                function searchNow(event) {
                          if (event.keyCode == "13") {
                     //document.activeElement.blur();
                    var kwd = $('#searchInput').val();
                    kwd = kwd.trim();
                    //$.toast('搜索 ' + kwd);
                    $("#YxList").children().remove();
                    //var loadmoreCur=$('#YxList').find('.weui-cell_access').length;

//搜索查询
$.ajax({
            url: basePath1+"testServlet",

            type: "GET",
            data: {action: 'find',
                   name_find:kwd,
                   offset:0,
                   pagesize:pagesize                   
            },
            crossDomain: true,
            dataType: "json",
            success: function (callBackData, textStatus, jqXHR) {
                 if( callBackData.length==pagesize )   {   
                       $("#ftLoad").children().remove();
                       $("#ftLoad").append(' <a href="javascript:;" class="weui-btn weui-btn_default" id="ClickLoadMore" style="color:#353535">点击加载更多</a>');
                       regmoreclick();   
                 }
                 for (var i = 0; i < callBackData.length; i++) {//插入营销员初始数据
                        $("#YxList").append(appendhtml(callBackData[i].DWMC,callBackData[i].id));                   
                 }
                RegClick() ;

            },error: function (XMLHttpRequest, strError, strObject) { 
               $.alert('网络有问题,请刷新!strError=' + strError + ' strObject=' + strObject);  
          }
        });


          }

     }


                //清空
                function clearSearch() {
                    $('#searchInput').val('');
                }

                 function RegClick() {
                     //  $('.js_item').on('click', function () {
                    $(".js_item").click(function () {       //给选中上个色
                        if (Cellid == null) {
                            Cellid = $(this).attr("id");
                            g_YXname=$(this).attr("name");
                            $(this).css('background-color', '#ccc8c8');
                            //alert(Cellid);
                            g_YXId=Cellid;
                        }
                        else {
                            $("#" + Cellid).css('background-color', '')
                            $(this).css('background-color', '#ccc8c8');
                            Cellid = $(this).attr("id");
                            g_YXname=$(this).attr("name");
                            //alert(Cellid);
                             g_YXId=Cellid;
                        }

                    });
                }
                var pagesize=5;

                $(function () {
                    g_ToastStr = "首页";

                    var jigouhao = $('#jigouhao').html()
                    var winH = $(window).height();
                    var categorySpace = 10;

                    //$("#searchCancel").click(clearSearch);

//首次加载
$.ajax({
            url: basePath1+"customer",

            type: "GET",
            data: {action: 'find',
                   name_find:'',
                   offset:0,
                   dwid:jigouhao,
                   pagesize:pagesize

            },
            crossDomain: true,
            dataType: "json",
            success: function (callBackData, textStatus, jqXHR) {

                 for (var i = 0; i < callBackData.length; i++) {//插入营销员初始数据
                        $("#YxList").append(append_customer_html_2(callBackData[i].name,callBackData[i].phone,callBackData[i].cardid,callBackData[i].id));   
                    }

                RegClick() ;
                
               // let myData=callBackData.data;
               // ipInfoObj.value=myData.country+""+myData.province+""+myData.city;
               // console.log(myData);
               if(callBackData.length<pagesize){
                       $("#ftLoad").children().remove();
                       $("#ftLoad").append('<a href="javascript:;" class="weui-btn weui-btn_default"  style="color:#353535">没有更多数据了</a>');                
                }
            },error: function (XMLHttpRequest, strError, strObject) { 
               $.alert('网络有问题,请刷新!strError=' + strError + ' strObject=' + strObject);  
          }
        });


                  /*  for (var i = 0; i < 20; i++) {//插入营销员初始数据
                        $("#YxList").append(appendhtml(i));
                       
                    }*/

                    //  $('#ClickLoadMore').on('click', function () {


            regmoreclick();             


            $("#gomenu").click(function () {    //弹出上拉菜单
                $.actions({
                    title: "选择操作",
                    onClose: function () {
                        console.log("close");
                    },
                    actions: [
                        {
                            text: "添加",
                            className: "color-primary",
                            onClick: function () {
                                $.alert("发布成功");
                                //window.pageManager.go('YingxiaoEdit');
                            }
                        },
                        {
                            text: "编辑",
                            className: "color-warning",
                            onClick: function () {
                                $.alert("你选择了“编辑”");
                                // window.pageManager.go('YingxiaoEdit');
                            }
                        },
                        {
                            text: "删除",
                            className: 'color-danger',
                            onClick: function () {
                                $.alert("你选择了“删除”");
                                // window.pageManager.go('demo');    //导航到子页面demo
                            }
                        }
                    ]
                });

            });
                   // var YxItemLists = $('#YxList').find('.weui-cell_access');

                    /*
                    $('.js_item').on('click', function () {
                        var id = $(this).data('id');
                        window.pageManager.go(id);  // button
                    });
                  
                    $('.js_category').on('click', function () {
                        var $this = $(this),
                            $inner = $this.next('.js_categoryInner'),
                            $page = $this.parents('.page'),
                            $parent = $(this).parent('li');
                        var innerH = $inner.data('height');
                        bear = $page;
    
                        if (!innerH) {
                            $inner.css('height', 'auto');
                            innerH = $inner.height();
                            $inner.removeAttr('style');
                            $inner.data('height', innerH);
                        }
    
                        if ($parent.hasClass('js_show')) {
                            $parent.removeClass('js_show');
                        } else {
                            $parent.siblings().removeClass('js_show');
    
                            $parent.addClass('js_show');
                            if (this.offsetTop + this.offsetHeight + innerH > $page.scrollTop() + winH) {
                                var scrollTop = this.offsetTop + this.offsetHeight + innerH - winH + categorySpace;
    
                                if (scrollTop > this.offsetTop) {
                                    scrollTop = this.offsetTop - categorySpace;
                                }
    
                                $page.scrollTop(scrollTop);
                            }
                        }
                    });
                    */

                });
            </script>
    </script>


    <script type="text/html" id="tpl_YingxiaoEdit">

        <div class="page">
            <div class="page__hd">
                <header class="wy-header">   
                     <div class="wy-header-title" id ="idTitle">客户修改</div>
                    <div class="wy-header-icon-back" id="goback1"><span></span></div> 
                 
                </header>
            </div>

            <div class="page__bd page__bd_spacing" style="margin-top: 0px">

                <div class="weui-cells weui-cells_form">

                 <div class="weui-cell" style="background-color:#ebedf0">
                        <div class="weui-cell__hd">
                            <label class="weui-label">ID</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="text" name="YGid"  value="" readonly >
                        </div>
                    </div>


                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">姓名</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="text" name="name" placeholder="请输入姓名(必填)" value="王二">
                        </div>
                    </div>

                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">手机号</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="tel" name="phonenum" placeholder="请输入手机号(必填)" value="13576112988">
                        </div>
                    </div>

                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">身份证号</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="text" name="idnum" placeholder="请输入身份证号(必填)" value="430201199201222290">
                        </div>
                    </div>

                    <div class="weui-cell" style="background-color:#ebedf0">
                        <div class="weui-cell__hd" >
                            <label class="weui-label">业务名</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="text" name="business_name" placeholder="  请输入业务名" readonly value="邮益宝">
                        </div>
                    </div>

                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">首次体验时间</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="text" name="first_time" style="text-align:center" placeholder="  请输入首次时间(选填)">
                        </div>
                    </div>

                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">首次体验金额</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="text" name="first_num" style="text-align:center" placeholder="  请输入金额(选填)" value="700" >
                        </div>
                    </div>

                </div>

                <div class="weui-cells weui-cells_form" id='signUpImage'>
                    <div class="weui-cell">
                        <div class="weui-cell__bd">
                            <div class="weui-uploader">

                                <div class="weui-uploader__hd">
                                    <p class="weui-uploader__title">上传身份证图片</p>
                                    <div class="weui-uploader__info"><span id='uploadNumber'>0</span>/ <span id='totalUploadNumber'>2</span>(每张5M以内)</div>
                                </div>

                                <div class="weui-uploader__bd">

                                    <ul class="weui-uploader__files" id="imgList">
                                    </ul>

                                    <div class="weui-uploader__input-box" id="ImageinputBack">

                                        <div id="imgInput" class="weui-uploader__input"></div>
                                    </div>

                                </div>

                            </div>
                        </div>
                    </div>
                </div>
                <div class="weui-btn-area">
                    <a class="weui-btn weui-btn_primary" href="javascript:;" id="showTooltips">确定</a>
                    <a href="javascript:history.back();" class="weui-btn weui-btn_default">返回</a>
                </div>

            </div>
            <div class="page__ft">
               
            </div>
        </div>
        <script type="text/javascript">

            function getUploadImage(ParentId) {
                var res = [];
                if (ParentId) {
                    $('#imgList li', $('#' + ParentId)).each(function () {
                        var lurl = $(this).attr('url');
                        res.push(lurl);
                    });
                    res = res.join(';');
                    return res;
                }
            }

            function deleteImage(obj) {

                $(obj).parent().remove();
                var YxItemLists = $('#YxList').find('.weui-uploader__file');
                var nIndexCur = YxItemLists.length;
                $('#uploadNumber', '#signUpImage').text(nIndexCur);
                $('#ImageinputBack').show();
            }
            function delExtension(file) {
                var fileName = file.name.lastIndexOf(".");//取到文件名开始到最后一个点的长度
                var fileNameLength = file.name.length;//取到文件名长度
                var fileFormat = file.name.substring(0, fileName);//截
                return fileFormat;
            }

            function InitUpload() {
                try {


                    var _t = $('#signUpImage');

                    var _dataJson = [" "], _self = this;
                    this.createItem = function (shopImageShow, serverId, url) {
                        if (!url) return false;
                        var item = $("<li class='weui-uploader__file'><i class='iconfont icon-delete delete-btn' onclick = 'deleteImage(this)'></i></li>");
                        item.css({ 'background-image': 'url(' + url + ')' });
                        item.attr('serverId', serverId);
                        if (url) {
                            item.attr('url', url);
                        }
                        shopImageShow.append(item);
                        $('#uploadNumber', _t).text(parseInt($('#uploadNumber', _t).text()) + 1);
                        return item;
                    };
                    var shopImageShow = $('#imgList', _t);

                    /*
                   
                    for(var i in _dataJson){
                        this.createItem(shopImageShow,'',_dataJson[i]);
                    }
                    
                    if($( '.uploadShopImg' , _t).length==0){
                        console.warn('图片上传组件没有找到上传按钮')
                    }; */

                    //this.createItem(shopImageShow,'111332323',"https://www.baidu.com/img/baidu_jgylogo3.gif");
                    var totalUploadNumber = parseInt($('#totalUploadNumber', _t).text());
            


                    $.fileUpload({
                        filebutton: "#imgInput",
                        url:'ClientAjax.aspx?method=FileImgUpload',
                        previewZoom: null,
                        maxWidth: $("#imgInput").width(),
                        uploadStart: function (file, src) {
                            // console.log("uploadStart", res);

                            if ($('#' + file.lastModified).length > 0) {
                                return false;
                            }else
                            {
                                var $preview = $('<li id="' + file.lastModified + '" name="ImageItem" class="weui-uploader__file weui-uploader__file_status"><div class="weui-uploader__file-content">0%</div></li>');
                                $('#imgList').append($preview);
                                $('#' + file.lastModified).css('background-image', 'url(' + src + ')');
                                return true;
                            }
                        },
                        uploadComplete: function (file, res) {

                            console.log("uploadComplete", res);
                            if ($('#' + file.lastModified).length > 0) {
                                res = JSON.parse(res);
                                //var nindexname = delExtension(file);

                                $('#' + file.lastModified).removeClass('weui-uploader__file_status').find('.weui-uploader__file-content').remove();
                                // 上传成功，想干点什么就在这里干吧
                                $('#' + file.lastModified).attr('url', res.data.src);

                                var nuploadNumber = parseInt($('#uploadNumber', _t).text()) + 1;
                                if (nuploadNumber <= totalUploadNumber) {
                                    $('#uploadNumber', _t).text(nuploadNumber);
                                    var item = $("<i class='iconfont icon-tubiaozhizuomoban-' style='float: right;' onclick = 'deleteImage(this)'></i>");
                                    $('#' + file.lastModified).append(item);

                                    $.noti({
                                        title: "提示！",
                                        text: "图片上传成功！",
                                        data: {
                                            message: "图片上传成功!"
                                        },
                                        time: 2000,
                                        onClick: function (data) {
                                          //  $.alert(data.message);
                                        }
                                    });

                                }
                                if (nuploadNumber >= totalUploadNumber) {//数量上限
                                    $('#ImageinputBack').hide();
                                }
                            }
                        },
                        uploadError: function (file, err) {
                            console.log("uploadError", err);
                           
                            $('#' + file.lastModified).remove();
                        },
                        onProgress: function (file, percent) {  // 提供给外部获取单个文件的上传进度，供外部实现上传进度效果
                            console.log(percent);
                          
                            $('#' + file.lastModified).find('.weui-uploader__file-content').html(percent + '%');
                        },
                    });

                } catch (e) {
                    console.log(e.message);

                }
               

            }


            function idcardCheck(num) {
                var errstr = "";
                num = num.toString();
                num = num.toUpperCase();
                //身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X。   
                if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(num))) {
                    //alert('输入的身份证号长度不对，或者号码不符合规定！\n15位号码应全为数字，18位号码末位可以为数字或X。');
                    errstr = "输入的身份证号长度不对，或者号码不符合规定！";
                    return {
                        result: false,
                        str: errstr
                    };
                }
                //校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。 
                //下面分别分析出生日期和校验位 
                var len, re;
                len = num.length;
                if (len == 15) {
                    re = new RegExp(/^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/);
                    var arrSplit = num.match(re);

                    //检查生日日期是否正确 
                    var dtmBirth = new Date('19' + arrSplit[2] + '/' + arrSplit[3] + '/' + arrSplit[4]);
                    var bGoodDay;
                    bGoodDay = (dtmBirth.getYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
                    if (!bGoodDay) {
                        //alert('输入的身份证号里出生日期不对！');
                        errstr = "输入的身份证号里出生日期不对！";
                        return {
                            result: false,
                            str: errstr
                        };
                    } else {
                        //将15位身份证转成18位 
                        //校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。 
                        var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
                        var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
                        var nTemp = 0,
                        i;
                        num = num.substr(0, 6) + '19' + num.substr(6, num.length - 6);
                        for (i = 0; i < 17; i++) {
                            nTemp += num.substr(i, 1) * arrInt[i];
                        }
                        num += arrCh[nTemp % 11];
                        return {
                            result: true,
                            str: errstr
                        };
                    }
                }
                if (len == 18) {
                    re = new RegExp(/^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/);
                    var arrSplit = num.match(re);

                    //检查生日日期是否正确 
                    var dtmBirth = new Date(arrSplit[2] + "/" + arrSplit[3] + "/" + arrSplit[4]);
                    var bGoodDay;
                    bGoodDay = (dtmBirth.getFullYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
                    if (!bGoodDay) {
                        //alert(dtmBirth.getYear()); 
                        //alert(arrSplit[2]); 
                        //alert('输入的身份证号里出生日期不对！'); 
                        errstr = "输入的身份证号里出生日期不对！";
                        return {
                            result: false,
                            str: errstr
                        };
                    } else {
                        //检验18位身份证的校验码是否正确。 
                        //校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。 
                        var valnum;
                        var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
                        var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
                        var nTemp = 0,
                        i;
                        for (i = 0; i < 17; i++) {
                            nTemp += num.substr(i, 1) * arrInt[i];
                        }
                        valnum = arrCh[nTemp % 11];
                        if (valnum != num.substr(17, 1)) {
                            //alert('18位身份证的校验码不正确！应该为：' + valnum); 
                            //    errstr="18位身份证的校验码不正确！应该为："+valnum;
                            errstr = "身份证格式错误，请重新输入！";
                            return {
                                result: false,
                                str: errstr
                            };
                        }
                        return {
                            result: true,
                            str: errstr
                        };
                    }
                }
                errstr = "输入的身份证号不对";
                return {
                    result: false,
                    str: errstr
                };
            }

            $(function () {
                //$.toast(g_ToastStr);
                if(g_YXId!=null)
                 {
                    $("input[name = 'idnum']").val( g_YXcardid );
                    $("input[name = 'YGid']").val( g_YXId );
                    $("input[name = 'name']").val( g_YXname);
                    $("input[name = 'phonenum']").val( g_YXphone);
                    $("input[name = 'first_time']").val( g_YXfirst_time);
                    $("input[name = 'first_num']").val( g_YXfirst_num);


                 }
                 else{
                   $("#idTitle").html('新增客户');
                }
                InitUpload();
                $("#goback1").click(function () {
                    history.back();
                });
                $("#showTooltips").click(function () {

                    var data = {};
                    data.ygid = $("input[name = 'YGid']").val();
                    data.name = $("input[name = 'name']").val();
                    data.phonenum = $("input[name = 'phonenum']").val();
                    data.idnum = $("input[name = 'idnum']").val();
                    data.first_time = $("input[name = 'first_time']").val();
                    data.first_num = $("input[name = 'first_num']").val();
                    data.dwid =  $('#jigouhao').html()

                    if (data.name.length < 2) {
                        $.alert('姓名长度太短');
                        return;
                    }

                    if ((/^[\u4e00-\u9fa5]*$/.test(data.name)) == false) {
                        $.alert('姓名格式不对');
                        return;
                    }


                    if (data.phonenum.length != 11) {
                        $.alert('手机号码长度不对');
                        return;
                    }
                    if (data.idnum.length != 15 && data.idnum.length != 18) {
                        $.alert('身份证号码长度不对');
                        return;
                    }
                    var resobj = idcardCheck(data.idnum);
                    if (resobj.result == false) {
                        $.alert(resobj.str);
                        return;
                    }

                    if ((/^[0-9]*$/.test(data.phonenum))) {
                        /*
                        var nuploadNumber = parseInt($('#uploadNumber', $('#signUpImage')).text());
                        if (nuploadNumber < 2) {
                            $.alert('图片数量不够!');
                            return;
                        }

                        data.imageurlArry = getUploadImage('signUpImage');
                        if (!data.imageurlArry) {
                            $.alert('请上传你的照片');
                            return;
                        }
                        $.alert(data.imageurlArry);
                        */
                $.ajax({ //新增或修改
                            url: basePath1+"customer_inser",

                            type: "GET",
                            data: {action: 'customer_inser',
                                YGid:data.ygid,
                                name:data.name,
                                phone:data.phonenum,
                                cardid:data.idnum,
                                first_num:data.first_num,
                                first_time:data.first_time,
                                dwid:data.dwid
                            },
                            crossDomain: true,
                            //dataType: "json",
                            success: function (callBackData, textStatus, jqXHR) {
                            
                            if(callBackData=="OK"){
                                history.back();
                                if(window.YXCallBack){ window.YXCallBack(data.ygid,data.name,data.idnum,data.phonenum); }
                            }else if (callBackData=="false"){
                                $.alert('身份证或手机号存在')
                            }else if (callBackData=="none"){
                                $.alert('未做修改')
                            }
                            else{
                                // alert(callBackData[0].name);
                                $.toptip(callBackData[0].name, 'error');
                            }
                            
                            },error: function (XMLHttpRequest, strError, strObject) { 
                                console.log(callBackData);
                            $.alert('网络有问题,请刷新!strError=' + strError + ' strObject=' + strObject);  
                        }
                        });

                        //console.log(JSON.stringify(data));
                    }
                    else {
                        $.alert('手机号码格式不对');
                        return;
                    }
                });

            });
        </script>
    </script>




    <script type="text/html" id="tpl_ShowCustomer">
    <div class="page">

            <div class="page__hd" style="position: fixed; z-index: 99; width: 100%">
                <header class='weui-header fixed-top'>

                    <div class="weui-search-bar" id="Div1">
                        <div class="wy-header-icon-back" id="goback2" style="position: absolute; left: 0; top: 4px; width: 35px; height: 38px;"><span></span></div>
                        <form class="weui-search-bar__form" action="#" style="margin-left: 40px">
                            <div class="weui-search-bar__box">
                                <i class="weui-icon-search"></i>
                                <input type="search" class="weui-search-bar__input" id="searchInputCust" placeholder="搜索" onblur="LostFoucs()">
                                <a href="javascript:" class="weui-icon-clear" id="A1"></a>
                            </div>
                            <label class="weui-search-bar__label" id="Label1" style="transform-origin: 0px 0px 0px; opacity: 1; transform: scale(1, 1);">
                                <i class="weui-icon-search"></i>
                                <span>搜索</span>
                            </label>
                        </form>
                        <a href="javascript:clearSearch();" class="weui-search-bar__cancel-btn" id="searchCancelcust">取消</a>
                    </div>

                </header>

                <div class="weui-panel weui-panel_access" style="margin-top: 0px">
                    <div class="weui-panel__bd">
                        <div class="weui-flex" style="padding-bottom: 2px; padding-top: 8px">

                            <div class="weui-flex__item">
                                <a href="javascript:window.pageManager.go('CustomerEdit');" class="weui-btn weui-btn_mini weui-btn_primary" style="margin-left: 40px">录入</a>
                            </div>

                            <div class="weui-flex__item">
                                <a href="javascript:window.pageManager.go('CustomerEdit');" class="weui-btn weui-btn_mini weui-btn_primary" style="margin-right: 40px;">修改</a>
                            </div>

                        </div>
                    </div>
                </div>

               <!--
              <div class="weui-panel weui-panel_access" style="margin-top: 0px">
                    <div class="weui-flex wy-iconlist-box" style="padding: 0 10px;">
                        <div class="weui-flex__item">
                            <a href="javascript:window.pageManager.go('CustomerEdit');" class="wy-links-iconlist">
                                <div class="img" style="width:80px;heigth:80px;">
                                      <img src="images/add.png"> 
                                </div>
                                <p>录入</p>
                            </a>
                        </div>
                        <div class="weui-flex__item">
                            <a href="javascript:window.pageManager.go('CustomerEdit');" class="wy-links-iconlist">
                                <div class="img" style="width:80px;heigth:80px;">
                                     <img src="images/edit.png"> 
                                </div>
                                <p>修改</p>
                            </a>
                        </div>
                    </div>
                </div>
                -->

            </div>

            <div class="page__bd page__bd_spacing" style="margin-top: 99px">

                <div class="weui-panel weui-panel_access" style="margin-top: 10px;">
                    <div class="weui-panel__bd">
                        <div class="weui-media-box weui-media-box_small-appmsg">

                            <div class="weui-cells" id="CustomerList">
                                <!--
                                <div class="weui-cell weui-cell_access" href="javascript:;" style="background-color: #ccc8c8;">
                                    <div class="weui-cell__bd">
                                        <p>客户1</p>
                                    </div>
                                </div>
                                
                                -->

                            </div>
                            appendhtml
                        </div>
                    </div>
                </div>
                <div class="weui-btn-area" id="ftLoadcust">
                    <!-- <a href="javascript:;" class="weui-btn weui-btn_default weui-btn_loading" style="color:#353535"><i class="weui-loading"></i>正在加载...</a> -->
                    <a href="javascript:;" class="weui-btn weui-btn_default" id="ClickLoadMoreCust" style="color:#353535">点击加载更多</a>
                </div>
                <div class="page__ft" >

                </div>

            </div>

            <script type="text/javascript">
                function LostFoucs() {

                    // $('#searchCancel').trigger('click');
                    //  clearSearch();
                }

                var CustCellid = null;

                function deleteCell() {
                    $("#" + CustCellid).remove();
                }
                



               function appendhtml(Num) {
                    var htmcode = '<a class="weui-cell weui-cell_access js_item" id="custcell_' + Num + '" name="custcellname"  href="javascript:;">' +
                                    ' <div class="weui-cell__bd">' +
                                         '<p>客户' + Num + '</p>' +
                                     '</div>' +
                                  '</a>';

                    return htmcode;
                }


                //监听搜索事件
                //document.getElementById('searchInputCust').addEventListener('keyup', function (e) { if (e.keyCode == 13) { searchNow(); } });
                 $('#searchInputCust').bind('keypress', searchNow);  
              //核心搜索函数
           function searchNow(event) {
               if (event.keyCode == "13") {
                    //  document.activeElement.blur();
                    var kwd = $('#searchInputCust').val();
                    kwd = kwd.trim();
                    $.toast('搜索 ' + kwd);
                }
           }

                //清空
                function clearSearch() {
                    $('#searchInputCust').val('');
                }

                $(function () {
                    g_ToastStr = "操作成功1";

                    var winH = $(window).height();
                    var categorySpace = 10;

                    //$("#searchCancel").click(clearSearch);
 
  




                    $("#goback2").click(function () {
                        history.back();
                    });

                    for (var i = 0; i < 20; i++) {
                        $("#CustomerList").append(appendhtml(i));

                    }


                    $("#ClickLoadMoreCust").click(function () {
                        $(this).hide();
                        $("#ftLoadcust").append('<a href="javascript:;" class="weui-btn weui-btn_default weui-btn_loading" style="color:#353535"><i class="weui-loading"></i>正在加载...</a>');

                        var YxItemLists = $('#YxList').find('.weui-cell_access');
                        var nIndexCur = YxItemLists.length;
                        for (var j = 0; j < 20; j++, nIndexCur++) {
                            $("#CustomerList").append(appendhtml(nIndexCur));
                        }

                        // $('.js_item').on('click', function () {
                        $(".js_item").click(function () {
                            if (CustCellid == null) {
                                CustCellid = $(this).attr("id");
                                $(this).css('background-color', '#ccc8c8');
                            }
                            else {
                                $("#" + CustCellid).css('background-color', '')
                                $(this).css('background-color', '#ccc8c8');
                                CustCellid = $(this).attr("id");
                            }

                        });

                    });


                    //  $('.js_item').on('click', function () {
                    $(".js_item").click(function () {
                        if (CustCellid == null) {
                            CustCellid = $(this).attr("id");
                            $(this).css('background-color', '#ccc8c8');
                        }
                        else {
                            $("#" + CustCellid).css('background-color', '')
                            $(this).css('background-color', '#ccc8c8');
                            CustCellid = $(this).attr("id");
                        }

                    });


                    // var YxItemLists = $('#YxList').find('.weui-cell_access');
                });

            </script>
    </script>



    <script type="text/html" id="tpl_CustomerEdit">

        <div class="page">
            <div class="page__hd">
                <header class="wy-header">
                    <div class="wy-header-icon-back" id="goback3"><span></span></div>
                    <div class="wy-header-title">客户录入</div>
                </header>
            </div>

            <div class="page__bd page__bd_spacing" style="margin-top: 0px">

                <div class="weui-cells weui-cells_form">

                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">姓名</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="text" name="name" placeholder="请输入姓名" value="呵呵">
                        </div>
                    </div>

                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">手机号</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="tel" name="phonenum" placeholder="请输入手机号" value="17161535444">
                        </div>
                    </div>

                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">身份证号</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="text" name="idnum" placeholder="请输入身份证号" value="51052119850508797x">
                        </div>
                    </div>

                </div>

                <div class="weui-btn-area">
                    <a class="weui-btn weui-btn_primary" href="javascript:;" id="BtnOKcustEdit">确定</a>
                    <a href="javascript:history.back();" class="weui-btn weui-btn_warn">取消</a>
                </div>

            </div>
            <div class="page__ft">
            
            </div>
        </div>
        <script type="text/javascript">

            $(function () {
                //$.toast(g_ToastStr);
                $("#goback3").click(function () {
                    history.back();
                });


                $("#BtnOKcustEdit").click(function () {

                    var data = {};

                    data.name = $("input[name = 'name']").val();
                    data.phonenum = $("input[name = 'phonenum']").val();
                    data.idnum = $("input[name = 'idnum']").val();

                    if (data.name.length < 2) {
                        $.alert('姓名长度太短');
                        return;
                    }

                    if ((/^[\u4e00-\u9fa5]*$/.test(data.name)) == false) {
                        $.alert('姓名格式不对');
                        return;
                    }


                    if (data.phonenum.length != 11) {
                        $.alert('手机号码长度不对');
                        return;
                    }
                    if (data.idnum.length != 15 && data.idnum.length != 18) {
                        $.alert('身份证号码长度不对');
                        return;
                    }
                    var resobj = idcardCheck(data.idnum);
                    if (resobj.result == false) {
                        $.alert(resobj.str);
                        return;
                    }

                    if ((/^[0-9]*$/.test(data.phonenum))) {

                        console.log(JSON.stringify(data));

                    }
                    else {
                        $.alert('手机号码格式不对');
                        return;
                    }
                });

            });
            function idcardCheck(num) {
                var errstr = "";
                num = num.toString();
                num = num.toUpperCase();
                //身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X。   
                if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(num))) {
                    //alert('输入的身份证号长度不对，或者号码不符合规定！\n15位号码应全为数字，18位号码末位可以为数字或X。');
                    errstr = "输入的身份证号长度不对，或者号码不符合规定！";
                    return {
                        result: false,
                        str: errstr
                    };
                }
                //校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。 
                //下面分别分析出生日期和校验位 
                var len, re;
                len = num.length;
                if (len == 15) {
                    re = new RegExp(/^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/);
                    var arrSplit = num.match(re);

                    //检查生日日期是否正确 
                    var dtmBirth = new Date('19' + arrSplit[2] + '/' + arrSplit[3] + '/' + arrSplit[4]);
                    var bGoodDay;
                    bGoodDay = (dtmBirth.getYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
                    if (!bGoodDay) {
                        //alert('输入的身份证号里出生日期不对！');
                        errstr = "输入的身份证号里出生日期不对！";
                        return {
                            result: false,
                            str: errstr
                        };
                    } else {
                        //将15位身份证转成18位 
                        //校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。 
                        var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
                        var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
                        var nTemp = 0,
                        i;
                        num = num.substr(0, 6) + '19' + num.substr(6, num.length - 6);
                        for (i = 0; i < 17; i++) {
                            nTemp += num.substr(i, 1) * arrInt[i];
                        }
                        num += arrCh[nTemp % 11];
                        return {
                            result: true,
                            str: errstr
                        };
                    }
                }
                if (len == 18) {
                    re = new RegExp(/^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/);
                    var arrSplit = num.match(re);

                    //检查生日日期是否正确 
                    var dtmBirth = new Date(arrSplit[2] + "/" + arrSplit[3] + "/" + arrSplit[4]);
                    var bGoodDay;
                    bGoodDay = (dtmBirth.getFullYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
                    if (!bGoodDay) {
                        //alert(dtmBirth.getYear()); 
                        //alert(arrSplit[2]); 
                        //alert('输入的身份证号里出生日期不对！'); 
                        errstr = "输入的身份证号里出生日期不对！";
                        return {
                            result: false,
                            str: errstr
                        };
                    } else {
                        //检验18位身份证的校验码是否正确。 
                        //校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。 
                        var valnum;
                        var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
                        var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
                        var nTemp = 0,
                        i;
                        for (i = 0; i < 17; i++) {
                            nTemp += num.substr(i, 1) * arrInt[i];
                        }
                        valnum = arrCh[nTemp % 11];
                        if (valnum != num.substr(17, 1)) {
                            //alert('18位身份证的校验码不正确！应该为：' + valnum); 
                            //    errstr="18位身份证的校验码不正确！应该为："+valnum;
                            errstr = "身份证格式错误，请重新输入！";
                            return {
                                result: false,
                                str: errstr
                            };
                        }
                        return {
                            result: true,
                            str: errstr
                        };
                    }
                }
                errstr = "输入的身份证号不对";
                return {
                    result: false,
                    str: errstr
                };
            }
        </script>
    </script>



    <!-- <script src="../js/jquery-2.1.4.js"></script> -->
    <script src="/static/js/zepto.min.js"></script>
    <script src="/static/js/jquery-weui.js"></script>
    <script src="/static/js/example.js"></script>
    <!-- <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> -->

    <!--  <script src="../js/webuploader-0.1.5/webuploader.min.js"></script> -->

    <script src="/static/js/zeptoUpload.js"></script>

    <script type="text/javascript">

        var g_ToastStr = "操作成功";
        var basePath1 = "http://0.0.0.0:5000/"
        var g_YXId = null;//
        var g_YXname = null;
        var g_YXphone = null;
        var g_YXyw = null;
        var g_YXfirst_time = null;
        var g_YXfirst_num = null;
        var ggg="A";//"B"


        


    </script>


</body>

</html>